Crate sharded_mutex
source · [−]Expand description
= ShardedMutex, aka ‘not so bad global lock’
This library provides global locks for (pseudo-) atomic access to data without memory overhead per object. Concurrency is improved by selecting a Mutex from a pool based on the Address of the object to be locked.
Even being sharded, these Mutexes act still as global and non-recursive locks. One must not try to lock another object while a lock is already hold, otherwise deadlocks are around the corner.
Structs
Wraps a ‘T’ that can only be accessed through global mutexes at zero memory overhead per object.
The guard returned from locking a ShardedMutex. Dropping this will unlock the mutex. Access to the underlying value is done by dereferencing this guard.